require("../../../../@babel/runtime/helpers/Arrayincludes"), (global.webpackJsonp = global.webpackJsonp || []).push([ [ "pages/home/components/new-coupon-login/index" ], {
    "996e": function(e, n, o) {
        (function(e) {
            var t = o("4ea4").default;
            Object.defineProperty(n, "__esModule", {
                value: !0
            }), n.default = void 0;
            var u, i = t(o("a34a")), a = t(o("9523")), r = t(o("c973")), s = t(o("5a0c")), c = o("8f12"), l = o("e820"), p = o("8f93"), d = o("3be3"), f = o("fd0e"), v = o("665c"), m = t(o("0613")), g = o("05dc"), h = o("cee8"), C = o("0d12"), _ = o("b70e");
            !function(e) {
                e[e.OLD = 1] = "OLD", e[e.FAIL = 2] = "FAIL";
            }(u || (u = {}));
            var b = {};
            b.props = {
                options: {
                    type: Object,
                    default: function() {}
                }
            }, b.setup = function(n, o) {
                var t = n, b = {
                    befrom: "",
                    isCouponsLoading: !0,
                    isCouponsShowing: !1
                }, w = o.emit;
                (0, f.onBeforeMount)(function() {
                    w("loaded", {
                        open: A,
                        externalAwaitCouponChecking: G,
                        externalCheckIsShowingModal: B,
                        afterLoginData: b,
                        unBindEvent: H
                    });
                });
                var L = (0, f.ref)([]), O = null, x = (0, f.ref)(!1), y = (0, f.ref)(!1), S = (0, 
                f.ref)(!1), k = (0, f.ref)(!1), N = (0, v.useGetters)().isLogined, E = (0, f.computed)(function() {
                    var e;
                    return "payCode" === (null === (e = t.options) || void 0 === e ? void 0 : e.pageFrom);
                }), I = (0, f.computed)(function() {
                    var e;
                    return "FTU" === (null === (e = t.options) || void 0 === e ? void 0 : e.pageFrom);
                }), D = (0, f.computed)(function() {
                    var e, n;
                    return "1" === (null === (e = t.options) || void 0 === e || null === (n = e.tx_travel) || void 0 === n ? void 0 : n.toString());
                });
                function P(e) {
                    m.default.commit("setState", e);
                }
                (0, f.watch)(function() {
                    return N.value;
                }, function(e) {
                    e || (S.value && F("logout-close"), S.value = !1, b.isCouponsLoading = !1, b.isCouponsShowing = !1, 
                    P({
                        newUserCouponsDisplayed: !1
                    }));
                }), (0, f.onBeforeMount)(function() {
                    console.info("debug new coupon: bindEvent"), e.$on(l.NEW_COUPON_LOGIN, function(e) {
                        var n = e.befrom;
                        console.info("debug new coupon: emit->", n), k.value = [ "newCouponLogin", "ulinkMiniCoupon" ].includes(n), 
                        b.befrom = n, J();
                    });
                }), (0, f.onMounted)((0, r.default)(i.default.mark(function e() {
                    return i.default.wrap(function(e) {
                        for (;;) switch (e.prev = e.next) {
                          case 0:
                            return C.homeOnloadPromise.value || (C.homeOnloadPromise.value = (0, _.createPromiseEvent)()), 
                            e.next = 3, C.homeOnloadPromise.value.promise;

                          case 3:
                            E.value || I.value || D.value ? J() : b.isCouponsLoading = !1;

                          case 4:
                          case "end":
                            return e.stop();
                        }
                    }, e);
                }))), (0, f.onBeforeUnmount)(function() {
                    H();
                });
                var U = null;
                function G() {
                    return M.apply(this, arguments);
                }
                function M() {
                    return (M = (0, r.default)(i.default.mark(function e() {
                        return i.default.wrap(function(e) {
                            for (;;) switch (e.prev = e.next) {
                              case 0:
                                return e.abrupt("return", new Promise(function(e) {
                                    U = e, b.isCouponsLoading || e();
                                }));

                              case 1:
                              case "end":
                                return e.stop();
                            }
                        }, e);
                    }))).apply(this, arguments);
                }
                function B() {
                    return !N.value && x.value && y.value || S.value;
                }
                function A() {
                    return new Promise(function(e) {
                        if (O = e, N.value) {
                            if (b.isCouponsLoading || b.isCouponsShowing) return;
                            F();
                        } else x.value = !0, j() ? ((0, g.statistics)("steer_receive_popup", {
                            module_name: "",
                            event_type: "曝光数"
                        }), $()) : ((0, g.statistics)("receive_popup_suspended", {
                            module_name: "新人红包悬浮球",
                            event_type: "曝光"
                        }), F());
                    });
                }
                function F() {
                    var e, n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "close";
                    null === (e = O) || void 0 === e || e({
                        type: n
                    }), R(), q(), b.isCouponsShowing = !1;
                }
                function j() {
                    var n = e.getStorageSync(c.COMMON.LOGIN_USER_COUPON_GUIDE), o = (0, s.default)().isSame((0, 
                    s.default)(Number(n)), "day");
                    return !(n && o || (e.setStorage({
                        key: c.COMMON.LOGIN_USER_COUPON_GUIDE,
                        data: Date.now()
                    }), 0));
                }
                function J() {
                    return T.apply(this, arguments);
                }
                function T() {
                    return (T = (0, r.default)(i.default.mark(function e() {
                        var n, o = arguments;
                        return i.default.wrap(function(e) {
                            for (;;) switch (e.prev = e.next) {
                              case 0:
                                if (n = o.length > 0 && void 0 !== o[0] ? o[0] : 2, m.default.state.userInfo.isNew) {
                                    e.next = 6;
                                    break;
                                }
                                return z("抱歉，您已经领过新人券了", u.OLD), F(), e.abrupt("return");

                              case 6:
                                return b.isCouponsLoading = !0, e.abrupt("return", (0, p.getNewUserCouponList)().then(function(e) {
                                    var o, t, i;
                                    if (0 === e.ret) if ((null === (o = e.data) || void 0 === o ? void 0 : o.length) > 0) L.value = e.data, 
                                    b.isCouponsLoading = !1, b.isCouponsShowing = !0, P({
                                        newUserCouponsDisplayed: !0
                                    }), null === (t = U) || void 0 === t || t(), W(); else if (n > 0) setTimeout(function() {
                                        J(n - 1);
                                    }, 800); else {
                                        var a;
                                        b.isCouponsLoading = !1, null === (a = U) || void 0 === a || a(), F();
                                    } else b.isCouponsLoading = !1, null === (i = U) || void 0 === i || i(), F(), z("抱歉，当前红包无法领取", u.FAIL);
                                }).catch(function() {
                                    var e;
                                    b.isCouponsLoading = !1, null === (e = U) || void 0 === e || e(), F(), z("抱歉，当前红包无法领取", u.FAIL);
                                }));

                              case 8:
                              case "end":
                                return e.stop();
                            }
                        }, e);
                    }))).apply(this, arguments);
                }
                function $() {
                    y.value = !0;
                }
                function R() {
                    y.value = !1;
                }
                function W() {
                    S.value = !0;
                }
                function q() {
                    S.value = !1;
                }
                function z(e, n) {
                    var o;
                    k.value && (k.value = !1, (0, g.statistics)("receive_toast_expo", {
                        toast_name: (o = {}, (0, a.default)(o, u.OLD, "老人已领取toast"), (0, a.default)(o, u.FAIL, "无法领取toast"), 
                        o)[n]
                    }), setTimeout(function() {
                        (0, h.$toast)({
                            name: "fail",
                            title: e
                        });
                    }, 800));
                }
                function H() {
                    console.info("debug new coupon: unBindEvent"), e.$off(l.NEW_COUPON_LOGIN);
                }
                return Object.assign({
                    coupons: L,
                    isShowLoginGuide: x,
                    isExpandedLoginGuide: y,
                    isShowCouponPopup: S,
                    isLogined: N,
                    openLogin: function() {
                        (0, g.statistics)("steer_receive_popup", {
                            module_name: "开",
                            event_type: "点击数"
                        }), e.navigateTo({
                            url: "/pages/login/index?befrom=newCouponLogin"
                        });
                    },
                    onClickCloseGuide: function() {
                        (0, g.statistics)("steer_receive_popup", {
                            module_name: "关闭",
                            event_type: "点击数"
                        }), F();
                    },
                    onClickExpandBtn: function() {
                        (0, g.statistics)("steer_receive_popup", {
                            module_name: "",
                            event_type: "曝光数"
                        }), (0, g.statistics)("receive_popup_suspended", {
                            module_name: "新人红包悬浮球",
                            event_type: "点击"
                        }), $();
                    },
                    onClickCouponCloseBtn: function() {
                        (0, d.handleOneDaySubscribe)("subscribe_newuser"), F();
                    },
                    onClickCouponConfirmBtn: function() {
                        (0, d.handleOneDaySubscribe)("subscribe_newuser"), F();
                    }
                }, {
                    open: A,
                    externalAwaitCouponChecking: G,
                    externalCheckIsShowingModal: B,
                    afterLoginData: b,
                    unBindEvent: H
                });
            }, b.components = Object.assign({
                Guide: function() {
                    Promise.all([ o.e("common/vendor"), o.e("pages/home/components/new-coupon-login/guide/index") ]).then(function() {
                        return resolve(o("c70c"));
                    }.bind(null, o)).catch(o.oe);
                },
                Coupons: function() {
                    o.e("pages/home/components/new-coupon-login/coupons/index").then(function() {
                        return resolve(o("f61e"));
                    }.bind(null, o)).catch(o.oe);
                }
            }, b.components);
            var w = b;
            n.default = w;
        }).call(this, o("543d").default);
    },
    c489: function(e, n, o) {
        o.r(n);
        var t = o("cdd8"), u = o("f2a5");
        for (var i in u) [ "default" ].indexOf(i) < 0 && function(e) {
            o.d(n, e, function() {
                return u[e];
            });
        }(i);
        var a = o("f0c5"), r = Object(a.a)(u.default, t.b, t.c, !1, null, "8da33820", null, !1, t.a, void 0);
        n.default = r.exports;
    },
    cdd8: function(e, n, o) {
        o.d(n, "b", function() {
            return t;
        }), o.d(n, "c", function() {
            return u;
        }), o.d(n, "a", function() {});
        var t = function() {
            this.$createElement;
            this._self._c;
        }, u = [];
    },
    f2a5: function(e, n, o) {
        o.r(n);
        var t = o("996e"), u = o.n(t);
        for (var i in t) [ "default" ].indexOf(i) < 0 && function(e) {
            o.d(n, e, function() {
                return t[e];
            });
        }(i);
        n.default = u.a;
    }
} ]), (global.webpackJsonp = global.webpackJsonp || []).push([ "pages/home/components/new-coupon-login/index-create-component", {
    "pages/home/components/new-coupon-login/index-create-component": function(e, n, o) {
        o("543d").createComponent(o("c489"));
    }
}, [ [ "pages/home/components/new-coupon-login/index-create-component" ] ] ]);